<?php
// Helper function for echoing variable to html if set and else echoing placeholder text
function put(&$var,$placeholder="PLACEHOLDER") {
    //deprecated echo (isset($var))?$var:'LOREM IPSUM<'.$placeholder.'>';
    $print = $placeholder;
    if (isset($var)) {
        if ($var !== '') { //check if empty string
            $print = $var;
        }
    } 
    echo $print;
}

// translates numeric rating to hate rating (string)
function translateRating($numRating) {
	if (0.5 < $numRating && $numRating < 1.5) {
		global $HATELEVEL1;
		$nameRating = $HATELEVEL1;
	} else if ($numRating < 2.5) {
		global $HATELEVEL2;
		$nameRating = $HATELEVEL2;
	} else if ($numRating < 3.5) {
		global $HATELEVEL3;
		$nameRating = $HATELEVEL3;
	} else if ($numRating < 4.5) {
		global $HATELEVEL4;
		$nameRating = $HATELEVEL4;
	} else if ($numRating < 5.5) {
		global $HATELEVEL5;
		$nameRating = $HATELEVEL5;
	} else {
		$namerating = "None";
	}
	return $nameRating;
}

function createUpdateResponse ($content) {
	//echo $content;
}

function createCommentResponse ($content) {
	//header("Location: " .$_SERVER['REQUEST_URI']);
}

?>